import Scene from "../Scene";
import { TButton, TLayout } from "../SceneControl";

const { ccclass, property } = cc._decorator;

@ccclass
export default class ExitPopScene extends Scene {

    protected onEnable(): void {
        super.onEnable();
        this.initScene();
    }

    initScene() {
        let layout = new TLayout();
        let btns = [
            [new TButton(this.node.children[0]), new TButton(this.node.children[1])]
        ]
        layout.buttonList = btns;
        this.tscene.addLayout(layout);
        this.tscene.onBack = this.onClickCancel.bind(this);
        this.tscene.joinController();
    }

    onClickCancel() {
        this.node.active = false;
    }

    onExitGame() {
        cc.game.end();
    }
}
